home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pcscheme / geneva / pcscheme.exe / BRIEF / B.ASC next >
Encoding:
Text File  |  1993-05-12  |  6.2 KB  |  209 lines

  1.  
  2.                   Scheme-BRIEF interface
  3.  
  4.  
  5.  
  6.                      Larry Bartholdi & his gang
  7.  
  8.  
  9.                             May 11, 1993
  10.  
  11. Contents
  12.  
  13.  
  14. 1  Introduction                                                    1
  15.  
  16.  
  17. 2  Installation                                                     1
  18.  
  19.  
  20. 3  Use of the Brief package                                       2
  21.  
  22.  
  23. 4  Bugs                                                            3
  24.  
  25.  
  26. 5  The PcScheme side                                             3
  27. 1   Introduction
  28.  
  29.  
  30. It is well known that many powerful editors (like Emacs) are based on
  31. Scheme and cohabit with it; and it is well known to Scheme programmers
  32. that closing 10 parentheses or so with primitive command editing and no
  33. indentation is painful.  Up to now, the only choice PcScheme users had
  34. was to endure the keyboard typing or to use the unreliable and poor editor
  35. EdWin.
  36.    Rather than re-write yet another powerful editor, I have chosen to make
  37. good use of the macro capabilities of an already-existing product, Brief1.
  38. Brief has many of the options provided by Emacs, while being well suited
  39. to PC compatibles; it is programmable in a subset of the C language.
  40.    The problem with this approach is interfacing between Brief and Pc-
  41. Scheme.  The solution chosen is to create a temporary file within Brief,
  42. that will be loaded as scheme code by PcScheme. The only two messages
  43. supported are "evaluate the buffer" and "evaluate the marked block", which
  44. are written as simple Scheme expressions by the Briefmacros.
  45. 2   Installation
  46.  
  47.  
  48. You need the following files:
  49.  
  50.  
  51. SCHEME.CM  the Brief compiled code
  52. ____________________________1
  53.    Briefis trademark of Borland International
  54.                                   1
  55.  
  56.  
  57. SCHEME.MNU  the help file
  58.  
  59.  
  60. SCHEME.CMP  the completion dictionary
  61.  
  62.  
  63. SCHEME.CB  (optional) the Brief source code.
  64.  
  65.  
  66. Move SCHEME.CM to "brief"macros and SCHEME.MNU to "brief"help; add
  67. "set BSCHEME=the path to SCHEME.CMP, including the trailing "" to your
  68. autoexec.bat file; and you know what to do with SCHEME.CB. . .
  69.    You then have to add the following to your initials macro file:
  70.  
  71.  
  72.  (macro .s
  73.      (
  74.           (tabs 9 17)
  75.           (if (== (inq`macro "scheme`indent") 0)
  76.               (load`macro "scheme")
  77.           )
  78.      )
  79.  )
  80.  
  81.  
  82. and (if you program in Scheme-WEB),
  83.  
  84.  
  85.  (macro .sw
  86.      (
  87.           (.s)
  88.      )
  89.  )
  90.  
  91.  
  92. Don't forget to recompile it!
  93. 3   Use of the Brief package
  94.  
  95.  
  96. A few commands have been redefined, following where possible the Brief
  97. tradition. Interface to PCS, () matching, indentation, S-expression marking,
  98. and word completion from an arbirary dictionary have been added to the
  99. basics.
  100.    The commands whose meaning changed are:
  101.  
  102.  
  103. <Enter> Automatically indents the next line
  104.  
  105.  
  106. <Ctrl-h> Provides a short description of the new commands
  107.  
  108.  
  109. ")" Searches for the matching "("; if the match is visible, highlights it for
  110.      a second; otherwise displays the line where the match came from on
  111.      the status line.
  112.  
  113.  
  114. <Tab> If a block has been marked, indents every line in the block; if the
  115.      cursor is in leading whitespace, indents the current line; otherwise
  116.      completes the current word. The current word is considered to start
  117.      at the closest parenthesis or whitespace backwards, whichever comes
  118.                                   2
  119.  
  120.  
  121.      first (well, last).  Continually depressing the <Tab> key searches for
  122.      another completion to the current word. <Esc> aborts the completion
  123.      process.
  124.  
  125.  
  126. <Shift-Tab> Positions the cursor to column 49 and inserts a ;_ (start of
  127.      comment). It is my hope this will make programs more readable. . .
  128.  
  129.  
  130. <Ctrl-G> Creates a menu of all the objects defined in the buffer. If proce-
  131.      dures are defined by (define (foo x y) ...), the procedure's name
  132.      with its arguments are displayed. In any case selecting an entry posi-
  133.      tions the cursor on that object's declaration.
  134.  
  135.  
  136. <Ctrl-A> Marks the smallest S-expression (list) containing the cursor. An
  137.      error occurs if the cursor is not inside a list.
  138.  
  139.  
  140. <Ctrl-Z> Marks the largest S-expression (list) containing the cursor.  An
  141.      error occurs if the cursor is not inside a list.
  142.  
  143.  
  144. <Alt-F10>  Evaluates the entire buffer, passing control to PcScheme (or
  145.      whoever called Brief).
  146.  
  147.  
  148. <Ctrl-F10>  Evaluates the marked block, passing control to PcScheme (or
  149.      whoever called Brief). If no block is marked, the largest S-expression
  150.      is selected first.
  151.  
  152.  
  153. <Ctrl-F1> Toggles on or off the tabbing and autoindentation features. Use
  154.      this when very desperate, esp. if you edit a very large file, or want to
  155.      insert some non-scheme text (like in Scheme-WEB).
  156. 4   Bugs
  157.  
  158.  
  159.    o We proudly inherit all bugs in Brief(!).
  160.  
  161.  
  162.    o Brief is not shareware.
  163.  
  164.  
  165.    o There is no mechanism to handle source-file errors elegantly.
  166.  
  167.  
  168.    o The macros may be slow; this is because CBrief is an interpreted
  169.      language.
  170.  
  171.  
  172.    o Some problems occur in Scheme-WEB files, when text editing should
  173.      supersede Scheme macro capabilities.
  174. 5   The PcScheme side
  175.  
  176.  
  177. A small procedure, b, is defined. It can be called with 0 or 1 arguments, the
  178. optional argument being faithfully passed to brief.
  179.    B calls Brief with all memory available and no screen-saving option.
  180. This is not necessary since Brief saves the screen itself.
  181.    B then loads the file handed back by Brief, and loads it.
  182.  
  183.  
  184.  
  185.                                   3
  186.  
  187.  
  188. (define (b . args)
  189.   (let ((brief (dos-search-file "b.exe"))
  190.          (transfer (string-append (dos-get-env "BSCHEME")
  191.                                     "scheme.tmp"))
  192.          (getarg (lambda (a)
  193.            (cond ((string? a) (string-append " " a))
  194.                  ((integer? a)
  195.                    (string-append " -m""goto`line "
  196.                                    (integer->string a 10)
  197.                                    """"))
  198.                  (else (error 'B "Invalid argument " a))))))
  199.     (if (null? brief)
  200.          (error 'B "Could not find B.EXE"))
  201.     (dos-call brief
  202.                (apply string-append (map getarg args))
  203.                0
  204.                1)
  205.     (if (file-exists? transfer)
  206.          (load transfer))
  207.     *the-non-printing-object*))
  208.                                   4
  209.